<template>
  <div id="app">
    <span v-color="'red'">我是全局自定义指令</span>
    <span v-color="'blue'">我是全局自定义指令</span>
    <span v-color="'yellow'">我是全局自定义指令</span>
  </div>
</template>
<script>
export default {
  name: "App",
  data() {
    return {}
  },
  directives: {
    color: {
      bind() {},
      inserted(el, binding) {
        el.style.color = binding.value
      },
      update(el, binding) {
        el.style.color = binding.value
      },
      componentUpdated(){},
      unbind(){}
    }
  }

}
</script>
<style lang="less"></style>
